home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 December / Dec99.iso / Data / Main.dxr / 00056_Openfile (buddy).ls < prev    next >
Encoding:
Text File  |  1999-10-05  |  2.2 KB  |  68 lines

  1. property theFile, TheProgram
  2.  
  3. on new me
  4.   return me
  5. end
  6.  
  7. on getPropertyDescriptionList me
  8.   description = [:]
  9.   addProp(description, #theFile, [#default: "none", #format: #string, #comment: "The file to open:"])
  10.   addProp(description, #TheProgram, [#default: "none", #format: #string, #comment: "The program to open the file(its Extension):"])
  11.   return description
  12. end
  13.  
  14. on getBehaivorDescription me
  15.   return "This behavior takes advantage of the Buddy API Xtra to locate Adobe Acrobat Reader on the users machine and then launch a pdf document from that app."
  16. end
  17.  
  18. on mouseUp me
  19.   if theFile <> "none" then
  20.     thePath = baFindApp(TheProgram)
  21.     if thePath <> EMPTY then
  22.       if the platform contains "windows" then
  23.       else
  24.         result = baOpenFile(the pathName & theFile, "normal")
  25.       end if
  26.       if result < 32 then
  27.         case result of
  28.           0:
  29.             Err = "Out of memory"
  30.           1:
  31.             Err = "Unknown error"
  32.           2:
  33.             Err = "File not found"
  34.           3:
  35.             Err = "Path not found"
  36.           5:
  37.             Err = "Sharing or network protection error"
  38.           6:
  39.             Err = "Library required seperate data segments for each task"
  40.           8:
  41.             Err = "Insufficient memory"
  42.           10:
  43.             Err = "Windows version was incorrect"
  44.           11:
  45.             Err = "Executable file invalid"
  46.           12:
  47.             Err = "Application was designed for a different operating system"
  48.           13:
  49.             Err = "Application was designed for MS-DOS 4.0"
  50.           14:
  51.             Err = "Type of executable file unknown"
  52.           15:
  53.             Err = "Attempt was made to load a real-mode app (developed for an earlier version of Windows)"
  54.           16:
  55.             Err = "Attempt was made to load a second instance of an executable file containing multiple data segments that were not marked read-only"
  56.           19:
  57.             Err = "Attempt was made to load a compressed executable file. The file must be decompressed before loaded"
  58.           20:
  59.             Err = "DLL file was invalid.  One of the DLLs required to launch this application was corrupt"
  60.           21:
  61.             Err = "Application requires 32-bit extensions"
  62.         end case
  63.         alert(Err)
  64.       end if
  65.     end if
  66.   end if
  67. end
  68.